package com.yytek.pm.tddb.init;




import com.yytek.pm.tddb.task.WriteTddbTask;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 初始化信息
 */
@Component
@ComponentScan(basePackages = {
        "com.yytek.pm.tddb"
})
public class DriverInitRunner implements ApplicationRunner {

    @Resource
    private ThreadPoolExecutor threadPoolExecutor;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //启动时序库写5个线程,默认1000条批量处理
        for (int i = 0; i < 5; i++) {
            Runnable worker = new WriteTddbTask();
            threadPoolExecutor.execute(worker);
        }
    }
}
